This relates generally to graphics processing and particularly to a shading technique call multi-sampling.
Multi-sampled anti-aliasing (multi-sampling or MSAA) is a technique that allows higher image quality by storing multiple color and depth sample values at each pixel. This permits higher precision for object edges, since each sample position is separately tested for whether it is inside or outside the primitive. The multi-sample image is “resolved” to a single sample per pixel when rendering is finished. A typical resolve function simply averages the sample values within each pixel.
Typically, when using MSAA, a single color is computed for all of the samples in a pixel that are within the primitive. As a result, interior pixels of a primitive have the same value at each sample. Samples have different values only in pixels that contain a triangle edge or vertex. This makes the rendering time required for MSAA rendering the same as for single-sampling for interior pixels.
Super-sampled anti-aliasing (super-sampling or SSAA) differs from MSAA in that it uses a higher precision pixel grid for rendering, which is then resolved to the desired pixel resolution. An MSAA and an SSAA image may have the same number of samples, but the SSAA image requires dramatically more processing, since a separate color must be computed for each sample.
Another difference between MSAA and SSAA is that SSAA typically uses an ordered grid of samples. That is, just as the pixels are defined at positions on a rectangular grid, the samples are also defined at positions on a rectangular grid. MSAA typically uses scattered sample positions within each pixel. E.g., 4×SSAA (4 samples per pixel) uses an aligned 2×2 grid of samples within each pixel. 4×MSAA typically uses four positions that cover four different X positions and four different Y positions. This results in higher quality edge anti-aliasing.
Texture filtering is a technique that allows scaling, rotating, and otherwise warping an image by applying a filtering function to the color values stored at multiple texels in the array. Typical filtering functions multiply each of a set of texel values by a filter weight and then sum the results. The set of texture values that are filtered are called the “footprint” of the filter function.
One type of texture filtering, called bilinear filtering or bilinear interpolation, generally requires a rectangular or square grid of sample positions. This technique linearly interpolates between two horizontal pairs of values at top and bottom of a rectangle and then linearly interpolates between those two values. While it is conceivable that a non-rectangular grid could be used, the calculation complexity would be sufficiently large to deter most practical applications.
When texture filtering is applied to multi-sampled images, a problem arises because multi-samples in conventional multi-sample images are not arranged within the pixel in a rectangular way. Another problem that arises with respect to conventional multi-sampling is that, in some situations with particular depicted objects, block artifacts will be created. These block artifacts are the result of samples within a pixel being rendered with the same color value when they are in the interior of a triangle or other rendered primitive. Typically multi-sample values only differ in a pixel when they are part of different primitives.
The standard way to texture filter a multi-sample image is to first convert it to a single-sample image. This is referred to as a “resolve” operation. A typical resolve operation simply averages the sample values within a pixel. Expressed as a filter function, a 4-sample resolve multiplies each sample value by 0.25 and then sums them. This blends color values across primitive edges and simply returns the common sample value for pixels entirely in the interior of a triangle or other primitive.